home *** CD-ROM | disk | FTP | other *** search
- // gpib.cpp
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream.h>
- #include <dos.h>
- #include "gpibio.h" // Defines GPIB STREAM Classes
-
- gpibout gout(5,0); // GPIB output device 5 stream on gpib board 0
- gpibin gin(5,0); // GPIB input device 5 stream on gpib board 0
-
- void main(void) // Example of using GPIB streams
- {
- char buffer[128];
-
- // Get identity
- if(!(gout <<"*idn?" << endl))
- {
- cerr << "Can't output *idn?" << endl;
- exit(1);
- }
- if(!(gin >> buffer))
- {
- cerr << "No *idn? response" << endl;
- exit(1);
- }
- cout << buffer << endl;
-
- // Request, get and display 10 frequency measurements
- for (int i=0; i<10; i++)
- {
- gout <<":MEAS:FREQ?;:SYST:TIME?" << endl;
- gin >> freq >> hr >> min >> sec;
- cout << "Frequency = " << freq;
- cout << ' ' << hr << ':' << min << ':' << sec << endl;
- }
- }
-